import {
    createCustomComponent
} from 'vue-amap';
export const AdvancedInfoWindow = createCustomComponent({
    name: 'advanced-info-window',
    props: ['content'],
    data:()=>{
        return {
            infoWindow:null,
            map:null
        }
    },
    contextReady() {},
    init(options) {
        this.map = options.map
        return new Promise((resolve, reject) => {
            this.infoWindow = new AMap.AdvancedInfoWindow({
                content:this.content,
                closeWhenClickMap:true,
                anchor: 'bottom-center',
                // offset: new AMap.Pixel(0, 0),
            });
            resolve(this.infoWindow);
        })
    },
    methods: {
        show(position){
            this.infoWindow.open(this.map,position);
        }
    }
})
